package com.cloudfun.msglisten.task;

import com.cloudfun.msglisten.ws.haier.handler.HaierWsDeviceMsgHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;

/**
 * Created by Huqin on 2020/3/13
 */
@Slf4j
@Component
public class ImeiBloomFilterTask {

    @Autowired
    private HaierWsDeviceMsgHandler haierWsDeviceMsgHandler;

    @Scheduled(fixedDelay = 30 * 1000)
    public void work() {
        StopWatch stopWatch = new StopWatch("ImeiBloomFilterTask");
        stopWatch.start("updateImeiBloomFilter");
        haierWsDeviceMsgHandler.updateImeiBloomFilter();
        stopWatch.stop();
        log.info(stopWatch.prettyPrint());
    }

}
